<?php
    session_start();
    include_once '../../../../controlador/php/conexion/Conexion.php';
    $con = new Conexion();
    
    $oid = $_REQUEST['oid'];
    $oidu = $_REQUEST['oidu'];

    $count="select COUNT(*)as num from segtomado where hcnsolexa = '".$oid."'";
     $res = $con->query($count);
     
     while($res2 = mssql_fetch_array($res)){
        $num = $res2['num'];
     }
     if($num == 0){
         $inser= "insert into segtomado(hcnsolexa,tmfecha,tmestado,usu_oid)values('".$oid."',GETDATE(),'1','".$oidu."')";
         $con->query($inser);
     }else{
         $update = "update segtomado
                    set tmfecha = GETDATE(),
                    tmestado ='1',
                    usu_oid = '".$oidu."'
                    where hcnsolexa = '".$oid."'";
         $con->query($update);
     }
       
    $con->cerrarConexion();
    
 
?>